package com.hmall.common.feign;

import com.hmall.common.dto.Item;
import com.hmall.common.dto.PageDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(name = "itemservice",path = "/item")
public interface ItemFeign {

    @GetMapping("list")
    public PageDTO<Item> Page(Integer page , Integer size);

    /**
     * 处理根据id查询
     * @param id
     * @return
     */
    @GetMapping("{id}")
    public Item selectById(@PathVariable Integer id);

    /**
     * 处理添加请求
     * @param item
     * @return
     */
    @PostMapping
    public void addItem(@RequestBody Item item);

    /**
     * 处理上下架商品请求
     * @param id
     * @param status
     */
    @PutMapping("status/{id}/{status}")
    public void soldStatus(@PathVariable Long id, @PathVariable Integer status);

    /**
     * 处理修改商品请求
     * @param item
     */
    @PutMapping
    public void updateItem(@RequestBody Item item);

    /**
     * 处理删除商品请求
     * @param id
     */
    @DeleteMapping("{id}")
    public void deleteItem(@PathVariable Long id);

}
